//@author A0105730U
#pragma once
#ifndef DATETIMELOCATOR_H                
#define DATETIMELOCATOR_H
#include <string>
#include <regex>
#include "DateParser.h"
#include "TimeParser.h"
#include "assert.h"
#include <vector>


//@author A0105730U
	const std::regex r_from("[f|F][r|R]?[o|O]?[m|M]?"); 
	const std::regex r_to("[t|T][o|O]?"); 
	const std::regex r_in("[i|I][n|N]?"); 
	const std::regex r_at("[a|A][t|T]?"); 
	const std::regex r_on("[o|O][n|N]?");
	const std::regex r_before("[b|B][e|E]?[f|F]?[o|O]?[r|R]?[e|E]?");
	const std::regex r_by("[b|B][y|Y]?");
	const std::regex r_till("[t|T][i|I][l|L]?[l|L]?"); 
	const std::regex r_until("[u|U][n|N]?[t|T]?[i|I]?[l|L]?");
	const std::regex proposition("[f|F][r|R]?[o|O]?[m|M]?|[t|T][o|O]?|[t|T][i|I][l|L]?[l|L]?|[i|I][n|N]?|[a|A][t|T]?|[o|O][n|N]?|[b|B][e|E]?[f|F]?[o|O]?[r|R]?[e|E]?|[b|B][y|Y]?|[u|U][n|N]?[t|T]?[i|I]?[l|L]?|\\s");

	const std::regex r_ampm("([0]\\d|[1][0-2]):([0-5]\\d)\\s?(?:AM|PM)");

	const std:: string NOT_FOUND_STRING_LOCATOR = " \",./?';:][{}\\|<>=+-_)(*&^%$#@!~`";
	const std:: string TRIPLE_ZERO = "0:00";
	const std:: string QUOTE_LOCATOR = "";
	const std:: string QUOTE_BLANK_LOCATOR =" ";
	const std:: string TWO_THREE_FIVE_NINE_LOCATOR = "23:59";
	const std:: string FOUR_ZERO_LOCATOR ="00:00";


//@author A0105730U
class DateTimeLocator
{
private:
	
public:

	DateTimeLocator(void);
	~DateTimeLocator(void);
	void detectTimePiece(std::string, size_t&, std::vector<std::string>&, std::vector<size_t>&, std::vector<size_t>&);
	void detectDatePiece(std::string, size_t&, std::vector<std::string>&, std::vector<size_t>&, std::vector<size_t>&);
	bool process(std::string, std::string&, std::string&, std::string&, std::string&, std::string&);
	std::string getName(std::string, size_t, size_t);
	std::string getWordBeforeGroup(std::string, size_t);
	std::string clear_Space_Punctuation(std::string);
	std::string getDefaultEndTime(std::string);

	std::string clear_Space_Punctuation_WithASpaceLeft(std::string);	
	bool LocateDateTimeWithoutConfusion (std::string , std::vector<size_t>&, std::vector<size_t> , std::vector<size_t> ,std::vector<size_t> ,std::vector<size_t> ,size_t &,size_t &);
	bool ConsistOfPrepositionOrSpace(std::string, std::size_t, std::size_t);

};

#endif